<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css"/>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="static/vant/index.css">
    <link rel="stylesheet" href="static/element/index.css">

    <title>Title</title>
    <style>
        .fail .layui-layer-content {
            background-color: brown;
            color: #eee;
            width: 400px;
            height: 30px;
            text-align: center;
        }

        .succeed .layui-layer-content {
            background-color: #0061A8;
            color: #eee;
            width: 400px;
            height: 30px;
            text-align: center;
        }
    </style>
</head>
<body>
<article class="page-container" id="app">
    <table style="table-layout:fixed; width: 100%; word-break:break-all;"
           class="table table-border table-bordered table-bg table-hover table-sort table-responsive" id="tablelist">
        <tbody id="datalist">
        <tr class="text-c">
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;">系统编号</td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="border:0; color:#b7b7b7" readonly="readonly"
                       v-model="tableLs.VALUE01">
            </td>
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;">登录帐号</td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="border:0;" v-model="tableLs.VALUE06" autocomplete="off">
            </td>
        </tr>
        <tr class="text-c">
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;">姓名</td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="border:0;" v-model="tableLs.VALUE02" autocomplete="off">
            </td>
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;">联系电话</td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="border:0;" v-model="tableLs.VALUE03" autocomplete="off">
            </td>
        </tr>
        <tr class="text-c">
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;">是否启用</td>
            <td style="font-size: 0.8rem;">
                <div style="text-align: left">
                    <el-radio v-model="tableLs.VALUE04" label="启用">启用</el-radio>
                    <el-radio v-model="tableLs.VALUE04" label="禁用">禁用</el-radio>
                </div>
            </td>
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;"></td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="border:0; width: 0; background-color: rgba(0,0,0,0);"
                       autocomplete="off">
            </td>
        </tr>
        <tr class="text-c">
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;"></td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="border:0; width: 0; background-color: rgba(0,0,0,0);"
                       autocomplete="off">
            </td>
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;"></td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="border:0; width: 0; background-color: rgba(0,0,0,0);"
                       autocomplete="off">
            </td>
        </tr>
        <tr class="text-c">
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;"></td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="border:0; width: 0; background-color: rgba(0,0,0,0);"
                       autocomplete="off">
            </td>
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;"></td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="border:0; width: 0; background-color: rgba(0,0,0,0);"
                       autocomplete="off">
            </td>
        </tr>
        </tbody>
    </table>
    <van-row style="margin-top: 25px;">
        <van-col span="6"></van-col>
        <van-col span="6"></van-col>
        <van-col span="6">
            <div style="text-align: right">
                <van-button type="primary" @click="fDo()" style="width: 80%">提交</van-button>
            </div>
        </van-col>
        <van-col span="6">
            <div style="text-align: right">
                <van-button type="info" @click="fExit()" style="width: 80%">返回</van-button>
            </div>
        </van-col>
    </van-row>
</article>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="static/axios.min.js"></script>
<script type="text/javascript" src="static/vue/vue.min.js"></script>
<script type="text/javascript" src="static/vant/vant.min.js"></script>
<script type="text/javascript" src="static/element/index.js"></script>
<script type="text/javascript">
    let vm = new Vue({
        el: '#app',
        data: {
            tableLs: {},
            do: ''
        },
        methods: {
            fDo() {
                let ls_opid = "${sessionOpid}";
                let params = new URLSearchParams();
                params.append('CMD', "ZH");
                params.append('VALUE01', this.tableLs.VALUE01);
                params.append('VALUE02', this.tableLs.VALUE02);
                params.append('VALUE03', this.tableLs.VALUE03);
                params.append('VALUE04', this.tableLs.VALUE04);
                params.append('VALUE05', this.tableLs.VALUE06);
                params.append('VALUE06', ls_opid);

                axios.post('/f_wscl/com2', params)
                    .then(function (res) {
                        let {db1} = res.data
                        if (db1[0].VALUE01 === 'ZZ01') {
                            layer.msg('<span style="font-size:24px; line-height: 30px">' + db1[0].VALUE02 + '</span>', {
                                time: 2000,
                                skin: 'fail'
                            });
                        } else if (db1[0].VALUE01 === 'ZZ00') {
                            layer.msg('<span style="font-size:24px; line-height: 30px">数据库操作完毕!</span>', {
                                time: 2000,
                                skin: 'succeed'
                            }, function () {
                                let index = parent.layer.getFrameIndex(window.name);
                                parent.fInit();
                                parent.layer.close(index);
                            });
                        }
                    })
                    .catch(function (error) {
                        layer.msg('<span style="font-size:24px; line-height: 30px">网络异常错误!</span>', {
                            time: 1500,
                            skin: 'fail'
                        });
                    });
            },

            fExit() {
                let index = parent.layer.getFrameIndex(window.name);
                parent.fInit();
                parent.layer.close(index);
            },

            fInit(o) {
                this.tableLs = o.tableLs
                this.tableLs.VALUE04 = '启用'
                this.do = o.do
            },

        },

        created() {
            window.fInit = this.fInit
        }
    })

    $(document).ajaxComplete(function (event, xhr, settings) {
        //从http头信息取出 在filter定义的sessionstatus，判断是否是 timeout
        if (xhr.getResponseHeader("sessionstatus") === "timeout") {
            //从http头信息取出登录的url ＝ loginPath
            if (xhr.getResponseHeader("loginPath")) {
                window.location.replace(xhr.getResponseHeader("loginPath"));
            }
        }
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
